package com.tanhua.domain.vo;

import lombok.Data;

import java.io.Serializable;
import java.util.Collections;
import java.util.List;

@Data
public class PageResult implements Serializable {

    private Integer counts = 0;//总记录数
    private Integer pagesize;//页大小
    private Integer pages = 0;//总页数
    private Integer page;//当前页码
    private List<?> items = Collections.emptyList(); //列表

    public PageResult(){}

    public PageResult(Integer page,Integer pagesize,int counts,List list) {
        this.counts = counts;
        this.pagesize = pagesize;
        this.page = page;
        this.items = list;
//        总共有16条数据  每页显示5条
//        总共有16条数据  每页显示5条
         this.pages = counts%pagesize==0?counts/pagesize:(counts/pagesize)+1;

    }
}
